import axiosInstance from '@/utils/request.js'

//获取加入购物车
export const addCartAPI = ({ skuId, count }) => {
  return axiosInstance({
    url: '/member/cart',
    method: 'POST',
    data: {
      skuId,
      count
    }
  })
}
//获取购物车列表
export const getCartListAPI = () => {
  return axiosInstance({
    url: '/member/cart',
  })
}
//获取删除购物车数据
export const delCartAPI = (ids) => {
  return axiosInstance({
    url: '/member/cart',
    method: 'DELETE',
    data: { ids }
  })
}
//合并购物车
/**
 * 
 * @param {*} data 数组；skuId count selected
 * @returns 
 */
export const mergeCartAPI = (data) => {
  return axiosInstance({
    url: '/member/cart/merge',
    method: 'POST',
    data
  })
}